/*
 * @Description: 菜单管理
 * @Author: xinqiao lxq1990.0716@qq.com
 * @Date: 2024-03-06
 * @LastEditors: xinqiao lxq1990.0716@qq.com
 * @LastEditTime: 2025-02-17
 */
import request from '/@/api/request'

/** 获取菜单列表 */
export const requestPermissionList = (data: PermissionListTypes.IRequest) => {
  return request.post<IBaseResponse<PermissionListTypes.IResponse[]>>('/system/ysys-user/permission/permissionList/V1', data)
}

/** 获取当前登录人关联菜单 */
export const requestGetPermissionByUserId = (data: GetPermissionByUserIdTypes.IRequest) => {
  return request.post<IPaginationResponse<GetPermissionByUserIdTypes.IResponse[]>>('/system/ysys-user/permission/getPermissionByUserId/V1', data)
}

/** 根据公司id获取当前登录人关联菜单 */
export const requestGetPermissionByCompanyId = (data: GetPermissionByCompanyIdTypes.IRequest) => {
  return request.post<IPaginationResponse<GetPermissionByCompanyIdTypes.IResponse[]>>('/system/ysys-user/permission/getPermissionByCompanyId/V2', data)
}

/** 获取模块列表 */
export const requestModuleList = (data: ModuleListTypes.IRequest) => {
  return request.post<IPaginationResponse<ModuleListTypes.IResponse[]>>('/system/ysys-user/permission/moduleList/V1', data)
}

/** 添加菜单 */
export const requestSavePermission = (data: SavePermissionTypes.IRequest) => {
  return request.post<IBaseResponse<SavePermissionTypes.IResponse>>('/system/ysys-user/permission/savePermission/V1', data)
}

/** 修改菜单 */
export const requestUpdatePermission = (data: UpdatePermissionTypes.IRequest) => {
  return request.post<IBaseResponse<UpdatePermissionTypes.IResponse>>('/system/ysys-user/permission/updatePermission/V1', data)
}

/** 删除菜单 */
export const requestDelPermission = (data: DelPermissionTypes.IRequest) => {
  return request.post<IBaseResponse<DelPermissionTypes.IResponse>>('/system/ysys-user/permission/delPermission/V1', data)
}

/** 根据菜单id获取菜单详情 */
export const requestGetPermissionById = (data: GetPermissionByIdTypes.IRequest) => {
  return request.post<IBaseResponse<GetPermissionByIdTypes.IResponse>>('/system/ysys-user/permission/getPermissionById/V1', data)
}

/** 获取菜单关联接口 */
export const requestGetPermissionInterfaces = (data: GetPermissionInterfacesTypes.IRequest) => {
  return request.post<IBaseResponse<GetPermissionInterfacesTypes.IResponse[]>>('/system/ysys-user/permission/getPermissionInterfaces/V1', data)
}

/** 菜单关联接口 */
export const requestSavePermissionInterfaces = (data: SavePermissionInterfacesTypes.IRequest) => {
  return request.post<IBaseResponse<SavePermissionInterfacesTypes.IResponse>>('/system/ysys-user/permission/savePermissionInterfaces/V1', data)
}
